<HTML><HEAD><TITLE>callable(?Term)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Type Testing</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>callable(?Term)</H1>
Succeeds if Term is callable, i.e. of type atom or compound.
<DL>
<DT><EM>Term</EM></DT>
<DD>Prolog term.
</DD>
</DL>
<H2>Description</H2>

Used to test whether Term is a 'callable' term, i.e. whether it
is an atom or compound term, and could therefore be used as a goal.
Note that this is a purely syntactic check which does not say
anything about the existence of a corresponding predicate.
<P>
This predicate is equivalent to
<PRE>
    callable(X) :- atom(X).
    callable(X) :- compound(X).
</PRE>
Note that it also succeeds for lists.

<H3>Modes and Determinism</H3><UL>
<LI>callable(?) is semidet
</UL>
<H3>Fail Conditions</H3>
Fails if Term is not an atom or a compound term
<H2>Examples</H2>
<PRE>
Success:
   callable(true).
   callable(hello("world",42)).
   callable(f(1,2)).
   callable([1,2,3]).
   callable(.(1,2)).
   callable(foo).
   callable([]).

Fail:
   callable("f(1,2)").
   callable(_).
   callable(42).
   make_suspension(true,0,S), callable(S).
</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/typetest/atom-1.html">atom / 1</A>, <A HREF="../../kernel/typetest/compound-1.html">compound / 1</A>, <A HREF="../../kernel/typetest/is_list-1.html">is_list / 1</A>, <A HREF="../../kernel/typetest/var-1.html">var / 1</A>
</BODY></HTML>
